import { getUpdatePwdVerifyCode } from '@/api/user'
import { ref } from 'vue'

/**
 * 获取更改密码的验证码
 */
export const useGetUpdatePwdVerifyCode = () => {
  // 获取验证码加载
  const getVerifyCodeLoading = ref(false)

  /**
   * 获取验证码
   * @param phone - 手机号
   */
  const getVerifyCode = async (phone: string) => {
    getVerifyCodeLoading.value = true
    const res = await getUpdatePwdVerifyCode(phone)
    getVerifyCodeLoading.value = false
    return res.data
  }

  return {
    getVerifyCodeLoading,
    getVerifyCode,
  }
}
